/*
 * File:   11377.cpp
 * Author: xerxes
 *
 * Created on September 18, 2011, 8:24 PM
 *
 * I have not failed, I have just found 10000 ways that won't work.
 */

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define VI vector< int >
#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define foR(i,st,ed) for(int i = st ; i < ed ; ++i )
#define fo( i, ed ) foR( i , 0 , ed )
#define foE(i,st,ed) for(int i = st ; i <= ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait(double seconds) {
    double endtime = clock()+(seconds * CLOCKS_PER_SEC);
    while (clock() < endtime) {
        ;
    }
}

int N; // number of city index
int M; // number of routes
int K; // cities already have airports
int airport[ 2002 ];
vector< VI > cango;
int k = 1;

inline void Read() {
    CI(N);
    CI(M);
    CI(K);
    SET(airport, 0);

    fo(i, K) {
        int x;
        CI(x);
        airport[ x - 1 ] = 1;
    }
    cango.assign(N + 2, VI());

    fo(i, M) {
        int x, y;
        CI(x);
        CI(y);
        cango[x - 1].pb(y - 1);
        cango[y - 1].pb(x - 1);
    }
}
#define pi pair<int,int>
int D[2002];
int F[2002];

inline int _Find(int sx, int sy) {
    if (sx == sy)return 0;
    //initialize start
    SET(F, 0);

    fo(i, 2002) {
        D[i] = (int) 1023456789;
    }
    //

    set< pi, less< pi > > pq;
    D[ sx ] = airport[sx] != 0 ? 0 : 1;
    pq.insert(mk(D[sx], sx));

    while (pq.empty() == false) {

        int father = pq.begin()->s;
        pq.erase(pq.begin());
        if (F[father])continue;

        //printf("Father , Airport = ( %3d %3d ) : \n",father+1, D[father]);
        for (int i = 0, j = SZ(cango[father]); i < j; ++i) {
            int child = cango[father][i];
            if (F[child])continue;
            int ccost = airport[child] != 0 ? 0 : 1;
            if (D[father] + ccost < D[ child ]) {
                D[child] = D[father] + ccost;
                //printf("GOING , AIRPORT = NOW AIRPORT = ( %3d %3d %3d )\n",child+1,ccost,D[child]);
                pq.insert(mk(D[child], child));
            }
        }
        //printf("\n");
        F[father] = 1;
    }
    return D[ sy ] < (int) 1023456789 ? D[sy] : -1;

}

inline void Proc() {
    int Q;
    CI(Q);
    printf("Case %d:\n", k);
    while (Q--) {
        int sx, sy;
        CI(sx);
        CI(sy);
        int var = _Find(sx - 1, sy - 1);
        cout << var << "\n";
    }
    printf("\n");
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("in", "rt", stdin);
#endif
    int cases = 1;
    for (CI(cases); cases; --cases, ++k) {
        Read();
        Proc();
    }

    return 0;
}


